﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace ParticlesEngine
{
    class SmokeParticlesSystem : ParticlesSystem {

        private double accumulatedTime;

        public SmokeParticlesSystem(int max) : base(max) { }
        public override void update(double elapsedTime){
            //este codigo no se porque motivo pero hace que salgan mas particulas... hay que mirarlo
            accumulatedTime += elapsedTime;
            if (accumulatedTime < 0.2) return;
            accumulatedTime = 0;
           
            //creating one particle per frame
            //suposing appeared at emitter position

            Random randomNumbersCreator = new Random();
            Vector3 velocity = new Vector3(0, randomNumbersCreator.Next(2)+1, 0);
            Vector3 acceleration = new Vector3(0, 100, 0);
            float timeLife = 10;
            float size = 10;
            float weight = 10;
            Color color = new Color(255, 255, 255);
            Color delta = new Color(255, 255, 255);
            base.addParticle(velocity, acceleration, timeLife, size, weight, color, delta);
        }
        
        public override void render() {
            
        }
        public override void initialize(){
            System.Console.Out.WriteLine("[SmokeParticlesSystem][initialize]");
            //loading smoke particles textures
            base.load("smoke");
        }
        public override void destroy()
        {
            base.destroy();
        }

    }
}
